package com.ruoyi.second.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.second.mapper.RentalhouseMapper;
import com.ruoyi.second.domain.Rentalhouse;
import com.ruoyi.second.service.IRentalhouseService;

/**
 * 出租房源Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-09-12
 */
@Service
public class RentalhouseServiceImpl implements IRentalhouseService 
{
    @Autowired
    private RentalhouseMapper rentalhouseMapper;

    /**
     * 查询出租房源
     * 
     * @param id 出租房源主键
     * @return 出租房源
     */
    @Override
    public Rentalhouse selectRentalhouseById(Long id)
    {
        return rentalhouseMapper.selectRentalhouseById(id);
    }

    /**
     * 查询出租房源列表
     * 
     * @param rentalhouse 出租房源
     * @return 出租房源
     */
    @Override
    public List<Rentalhouse> selectRentalhouseList(Rentalhouse rentalhouse)
    {
        return rentalhouseMapper.selectRentalhouseList(rentalhouse);
    }

    /**
     * 新增出租房源
     * 
     * @param rentalhouse 出租房源
     * @return 结果
     */
    @Override
    public int insertRentalhouse(Rentalhouse rentalhouse)
    {
        rentalhouse.setCreateTime(DateUtils.getNowDate());
        return rentalhouseMapper.insertRentalhouse(rentalhouse);
    }

    /**
     * 修改出租房源
     * 
     * @param rentalhouse 出租房源
     * @return 结果
     */
    @Override
    public int updateRentalhouse(Rentalhouse rentalhouse)
    {
        rentalhouse.setUpdateTime(DateUtils.getNowDate());
        return rentalhouseMapper.updateRentalhouse(rentalhouse);
    }

    /**
     * 批量删除出租房源
     * 
     * @param ids 需要删除的出租房源主键
     * @return 结果
     */
    @Override
    public int deleteRentalhouseByIds(Long[] ids)
    {
        return rentalhouseMapper.deleteRentalhouseByIds(ids);
    }

    /**
     * 删除出租房源信息
     * 
     * @param id 出租房源主键
     * @return 结果
     */
    @Override
    public int deleteRentalhouseById(Long id)
    {
        return rentalhouseMapper.deleteRentalhouseById(id);
    }
}
